|
|
 |
|
|
|
|
tbrMain.RestoreToolbar "Toolbars-" & App.EXEName, _
Me.Name, _
"MainToolbar"
mboolRestore = False
End Sub |
|
|
|
|
|
|
|
|
Notice the use of the module-level Boolean variable mboolRestore in this event as well as in the tbrMain_Change() event. When you perform a RestoreToolbar method, it causes the Change() event of the toolbar to fire. Therefore, by setting the mboolRestore variable to True, you can test to see whether this variable is set when the tbrMain_Change() event fires. If it is, you can bypass the SaveToolbar method. |
|
|
|
|
|
|
|
|
Invoking Customization with Code |
|
|
|
|
|
|
|
|
You can open the Customize Toolbar dialog box by invoking the Customize method on the toolbar. You might choose to invoke this command yourself instead of having the user double-click on the toolbar. For example, you might want to create a menu item that performs customization, or you might want them to use the right mouse button to invoke the customization. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub tbrMain_MouseUp(Button As Integer, _
Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then tbrMain.Customize End If
End Sub |
|
|
|
|
|
|
|
|
Creating Toolbars at Runtime |
|
|
|
|
|
|
|
|
Once youve assigned the ImageList property of the toolbar control, youll be unable to change the ImageList control without losing all the icons on the toolbar. This means you cant add or delete any images. Because things will change over time, this is not very realistic, and youll need to modify the ImageList control. As a result, youll probably want to build your toolbars at runtime. Lets look at another example that shows you how to build toolbars at runtime. |
|
|
|
|
|
|
|
|
Examples Filename: ToolbarRuntime.frm |
|
|
|
|
|